The Dictionary Console
======================

Dictionary mode is a console for consulting dictionaries.  A window in Dict
mode is associated to a dictionary.  The window has two fields: a one-line
input field and the rest of the window is an output field.  Type a word in
the input field and hit return (or enter) and the corresponding entry is
shown in the output field.  The 'corresponding entry' is the first entry in
the dictionary which is greater than or equal to the word, accroding to the
criterion specific to the dictionary.  While the dictionary article appears
in the output field, the word in the input field becomes selected: now you
type the next word on top of that selected block.

Instead of typing words and hitting return you have the following 
possibilities, quite standard in dictionary programmes:   These functions
are bound to keys as follows:

Cmd-up    See the preceding article in the dictionary
Cmd-down  See the follwing article
Cmd-left  Go back (to the previous word you looked up)
Cmd-right Go forth (to the word you looked up after the actual one
          (this makes sense only if you have previously used the back
					function)).  
					These two functions are meant to work like back and forth in 
					a web browser.
					
With arrow keys (unmodified) you can navigate through the output field,
jumping from word to word.  The output field is completely hyperised:
whenever you hit return, the word under the cursor is looked up.


Invoking the Dictionary Console
===============================

In any window, the key Ctrl-O is bound to bringing the Console to front,
and at the same time looking up the word that happens to by under the 
cursor at that time (I.e. selected text if any; otherwise the word 
preceeding the cursor in the text).

Now you can play around as explained above, until you got the information
you wanted.  Now press Ctrl-O again and you are back to the spot in the
window from where you invoked the dictionary.

Thus a typical short lookup sequence consists in

1) typing in the text you are writing
2) after writing a dubious word, hit Ctrl-O
3) read the article in the Console, hit Ctrl-O again, and
4) continue writing


Changing dictionary
===================

The programme manages an arbitrary number of dictionaries, which are
loaded as needed.  Each has its own Console, and its own history list
etc.  One of the dictionaries is 'Default' or 'Current'.  This is the one
called by Ctrl-O.  To change the Current dictionary, hit Ctrl-shift-O
and choose from the available dictionaires in the listpick dialogue.
This brings the Console of the new dictionary to front, with the word
under the cursor already looked up.  This new dictionary is now 'current'.


Installation
============

Put the file DictMode.tcl into $HOME:Tcl:Modes
Write this line in your prefsfile:
   source [file join $HOME Tcl Modes DictMode.tcl]
Now you need to edit a couple of parameters in the file DictMode.tcl:
You must choose a folder for all dictionaries  (say HD:dics )  Now
adjust the initialisation of the variable Dict::dictDir (set near the
beginning of the file):   
   set Dict::dictDir HD:dics
Now edit the variable availableDics.  It must be a list consisting of
the dictionary files located in HD:dics.  Choose the most important of 
them and declare it current (a little bit below in the file), eg.:
   set currentDic "Webster-1913"



Preparing and Installing new dictionaries
=========================================

Three things are needed: 

1) a dictionary file in plain text, with one entry per line (line 
termination \r), and consistently sorted.  The name of the dictionary 
(say 'MyDictionary') must be reasonable: no spaces, no special 
characters like $ ( \.   Place the dicitonary file (say MyDictionary)
in the dictionary folder you have specified in the DictMode.tcl file.

2) a proc which reduce words according to the principle the dictionary is
sorted by.  This is mostly a question of deciding how to handle accented
letters, whitespace, and hyphens...
3) a proc which formats the output, removing or substituting tags, or 
indenting.  F.ex. a carefully prepared dictionary file could have certain 
characters standing in for line-breaks, which must be converted, before 
displaying the text in the console, or it might be structured by html-tags.

These two procs must be placed in a file called 'MyDictionary.norm.tcl' and
located in the dictionary folder. The first proc must be called
'Dict::MyDictionary::normalForm' and the second
'Dict::MyDictionary::formatVerbet'.   Look in the file fallback.norm.tcl
to see how these procs work, and adjust them to the formatting of your 
dictionary.

The name of the new dictionary must be appended to the variable 
availableDics which is defined in the beginning of the file
DictMode.tcl.



